<template>
  <div id="app" style="background-color: rgba(235, 235, 235, 0.08)" @click="moveEvent"
  >
    <router-view/>
  </div>
</template>
<script>
  export default {
    name: 'app',
    data() {
      return {
        timmer: null,
      }
    },
    methods: {
      moveEvent() {
        let path = ['/']
        if (!path.includes(this.$route.path)) { //如果不是登录页面的话页面停止进行30分钟后清空session
          clearTimeout(this.timmer);
          this.init();
        }
      },
      init() {
        this.timmer = setTimeout(() => {
          sessionStorage.removeItem("sessionData");//清除session
          sessionStorage.clear();//清除缓存
          this.$alert("登录失效，请重新登录！")
          this.$router.push({
            name: '登录',
          });
        }, 200 * 60 * 1000);//设置15分钟清空session进入屏保
      },
    }
  }
</script>
<style>
  #app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    margin-top: 60px;
  }
</style>
